/*
 * @作者: 赖乾恩
 * @邮箱: laiqe@qq.com
 * @功能: 
 * @包含算法: 
 * Copyright (c) 2023 by 赖乾恩, All Rights Reserved. 
 */
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
//
一个整数数组，区分红蓝，挑一红一蓝组合，其成绩为权值；求所有合法权值之和；
//

int main(){
    //freopen("1.in","r",stdin);
    int n,ans = 0;
    cin >> n;
    vector<int> data(n);
    string s;
    vector<int> red_index,blue_index;
    
    for(int i = 0; i < n; i++){
        // int temp;
        cin >> data[i];
    }
    cin>>s;
    for(int i =0;i<s.size();i++){
        if(s[i]=='R'){
            red_index.push_back(i);
        }
        else{
            blue_index.push_back(i);
        }
    }
    for(int i=0;i<red_index.size();i++){
        for(int j=0;j<blue_index.size();j++){
            ans += data[red_index[i]]*data[blue_index[j]];
        }
    }

    cout << ans%(1000000000+7) << endl;
    return 0;
}